<?php

namespace App\Models;

use App\Enums\DomainType;
use App\Models\Traits\BelongsToApplication;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;

class Spider extends Model
{
    use BelongsToApplication;

    protected $casts = [
        'type' => DomainType::class,
    ];

    public function spiderable(): MorphTo
    {
        return $this->morphTo();
    }

    public function domainPool(): BelongsTo
    {
        return $this->belongsTo(DomainPool::class)
            ->withTrashed();
    }
}
